local dangkou = fk.CreateSkill {
  name = "lvshi__dangkou",
  tags = {Skill.Switch},
}

dangkou:addEffect(fk.Damage, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(dangkou.name) and player:usedSkillTimes(dangkou.name) == 0 then
      if player:getSwitchSkillState(dangkou.name, false) == fk.SwitchYang then
        return data.damage >= 2
      elseif player:getSwitchSkillState(dangkou.name, false) == fk.SwitchYin then
        return data.damageType == fk.FireDamage
      end
    end
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    local prompt = "#lvshi__dangkou-choose1"
    if player:getSwitchSkillState(self.name, false) == fk.SwitchYin then
      prompt = "#lvshi__dangkou-choose2"
    end
    local result = room:askToChoosePlayers(player, {
      targets = room:getOtherPlayers(data.to),
      min_num = 1,
      max_num = 1,
      prompt = prompt,
      skill_name = dangkou.name,
    })
    if #result > 0 then
      room:sortByAction(result)
      event:setCostData(self, {tos = result})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local n, m
    if player:getSwitchSkillState(dangkou.name, true) == fk.SwitchYang then
      n = 1
      m = 3
    elseif player:getSwitchSkillState(dangkou.name, true) == fk.SwitchYin then
      n = 2
      m = 1
    end
    player.room:damage({
      from = player,
      to = event:getCostData(self).tos[1],
      damage = n,
      damageType = m,
      skillName = dangkou.name,
    })
  end,
})

Fk:loadTranslationTable{
  ["lvshi__chengpu"] = "程普",
  ["#lvshi__chengpu"] = "三朝虎首",
  ["designer:lvshi__chengpu"] = "拉+猪",

  ["lvshi__dangkou"] = "荡寇",
  [":lvshi__dangkou"] = "回合技，转换技，①当你造成伤害后，若伤害点数至少为2，你可对另一名其他角色造成1点火焰伤害；②当你造成火焰伤害后，你可对另一名角色造成2点伤害。",
  [":lvshi__dangkou_yang"] = "回合技，转换技，<font color=\"#0FFF50\">①当你造成伤害后，若伤害点数至少为2，你可对另一名其他角色造成1点火焰伤害；" ..
  "</font>②当你造成火焰伤害后，你可对另一名角色造成2点伤害。",
  [":lvshi__dangkou_yin"] = "回合技，转换技，①当你一次造成至少2点伤害后，你可对另一名其他角色造成1点火焰伤害；" ..
  "<font color=\"#0FFF50\">②当你造成火焰伤害后，你可对另一名角色造成2点伤害。</font>",
  
  ["#lvshi__dangkou-choose1"] = "荡寇：请选择一名角色，对其造成1点火焰伤害",
  ["#lvshi__dangkou-choose2"] = "荡寇：请选择一名角色，对其造成2点伤害",

  ["$lvshi__dangkou1"] = "叛军者，非烈火灼身难泄吾恨。",
  ["$lvshi__dangkou2"] = "投敌于火，烧炙其身，皮焦肉烂！",
}

return dangkou